<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qqmlinfo.cpp -->
  <title>QtQml Namespace | Qt QML 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtqml-index.html">Qt QML</a></td><td >QtQml 命名空间</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtqml-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">目录</a></h3>
<ul>
<li class="level1"><a href="#functions">函数</a></li>
<li class="level1"><a href="#details">详细信息</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QtQml 命名空间</h1>
<!-- $$$QtQml-brief -->
<p>提供为QML类型生成日志消息的函数。 <a href="#details">更多...</a></p>
<!-- @@@QtQml -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> 头文件：</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QtQml&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += qml</td></tr></table></div><ul>
</ul>
<a name="functions"></a>
<h2 id="functions">函数</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QQmlInfo </td><td class="memItemRight bottomAlign"><b><a href="qqmlengine.html#qmlDebug">qmlDebug</a></b>(const QObject *<i>object</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QQmlInfo </td><td class="memItemRight bottomAlign"><b><a href="qqmlengine.html#qmlInfo">qmlInfo</a></b>(const QObject *<i>object</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QQmlInfo </td><td class="memItemRight bottomAlign"><b><a href="qqmlengine.html#qmlWarning">qmlWarning</a></b>(const QObject *<i>object</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QtQml-description -->
<div class="descr">
<h2 id="details">详细信息</h2>
<p>提供为QML类型生成日志消息的函数。</p>
</div>
<!-- @@@QtQml -->
<div class="func">
<h2>函数文档</h2>
<!-- $$$qmlDebug[overload1]$$$qmlDebugconstQObject* -->
<h3 class="fn" id="qmlDebug"><a name="qmlDebug"></a><span class="type">QQmlInfo</span> QtQml::<span class="name">qmlDebug</span>(const <span class="type"><a href="../qtcore/qobject.html">QObject</a></span> *<i>object</i>)</h3>
<p>打印包含指定QML对象的文件和行号的调试消息。</p>
<p>当QML类型产生日志消息时，如果它们包括实例化的特定实例的QML文件和行号，就可以提高可跟踪性。</p>
<p>要包含文件和行号，必须传递一个对象。如果文件和行号对该实例不可用(它不是由QML引擎实例化的，或者位置信息被禁用)，那么将使用“未知位置”。例如,</p>
<pre class="cpp">

  qmlDebug(object) <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;Internal state: 42&quot;</span>;

</pre>
<p><span lang="zh-cn">打印</span></p>
<pre class="cpp plain">

  QML MyCustomType (unknown location): Internal state: 42

</pre>
<p>这个函数在Qt 5.9中引入。</p>
<p><b>请参考 </b><a href="qqmlengine.html#qmlInfo">QtQml::qmlInfo</a> and <a href="qqmlengine.html#qmlWarning">QtQml::qmlWarning</a>.</p>
<!-- @@@qmlDebug -->
<!-- $$$qmlInfo[overload1]$$$qmlInfoconstQObject* -->
<h3 class="fn" id="qmlInfo"><a name="qmlInfo"></a><span class="type">QQmlInfo</span> QtQml::<span class="name">qmlInfo</span>(const <span class="type"><a href="../qtcore/qobject.html">QObject</a></span> *<i>object</i>)</h3>
<p>打印包含指定QML对象的文件和行号的信息消息。</p>
<p>当QML类型产生日志消息时，如果它们包括实例化的特定实例的QML文件和行号，就可以提高可跟踪性。</p>
<p>要包含文件和行号，必须传递一个对象。如果文件和行号对该实例不可用(它不是由QML引擎实例化的，或者位置信息被禁用)，那么将使用“未知位置”。</p>
<p>例如,</p>
<pre class="cpp">

  qmlInfo(object) <span class="operator">&lt;</span><span class="operator">&lt;</span> tr(<span class="string">&quot;component property is a write-once property&quot;</span>);

</pre>
<p>打印</p>
<pre class="cpp plain">

  QML MyCustomType (unknown location): component property is a write-once property

</pre>
<p><b>注意： </b>在Qt 5.9之前的版本中，qmlInfo使用警告<a href="../qtcore/qtglobal.html#QtMsgType-enum">QtMsgType</a>报告消息。对于Qt 
5.9及以上版本，qmlInfo使用一个信息<a href="../qtcore/qtglobal.html#QtMsgType-enum">QtMsgType</a>。要发送警告，请使用<a href="qqmlengine.html#qmlWarning">qmlWarning</a>。</p><p><b>请参考 </b><a href="qqmlengine.html#qmlDebug">QtQml::qmlDebug</a> 
	<span lang="zh-cn">和 </span><a href="qqmlengine.html#qmlWarning">QtQml::qmlWarning</a><span lang="zh-cn">。</span></p>
<!-- @@@qmlInfo -->
<!-- $$$qmlWarning[overload1]$$$qmlWarningconstQObject* -->
<h3 class="fn" id="qmlWarning"><a name="qmlWarning"></a><span class="type">QQmlInfo</span> QtQml::<span class="name">qmlWarning</span>(const <span class="type"><a href="../qtcore/qobject.html">QObject</a></span> *<i>object</i>)</h3>
<p>打印警告消息，其中包括指定QML对象的文件和行号。</p>
<p>当QML类型产生日志消息时，如果它们包括实例化的特定实例的QML文件和行号，就可以提高可跟踪性。</p>
<p>要包含文件和行号，必须传递一个对象。如果文件和行号对该实例不可用(它不是由QML引擎实例化的，或者位置信息被禁用)，那么将使用“未知位置”。</p>
<p>例如,</p>
<pre class="cpp">

  qmlInfo(object) <span class="operator">&lt;</span><span class="operator">&lt;</span> tr(<span class="string">&quot;property cannot be set to 0&quot;</span>);

</pre>
<p><span lang="zh-cn">打印</span></p>
<pre class="cpp plain">

  QML MyCustomType (unknown location): property cannot be set to 0

</pre>
<p>这个函数在Qt 5.9中引入。</p>
<p><b>请参考 </b><a href="qqmlengine.html#qmlDebug">QtQml::qmlDebug</a> 
<span lang="zh-cn">和 </span><a href="qqmlengine.html#qmlInfo">QtQml::qmlInfo</a><span lang="zh-cn">。</span></p>
<!-- @@@qmlWarning -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
